home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 February: Tool Chest / Dev.CD Feb 94.toast / New System Software Extensions / QuickDraw™ GX v1.0ß2 / Sample Code / Typography Samples / Basic Layout Sample ƒ / Basic Layout Sample.c next >
Encoding:
C/C++ Source or Header  |  1993-09-09  |  14.4 KB  |  725 lines  |  [TEXT/MPS ]

  1. /*
  2.  *    basic layout sample.c
  3.  *    By Eric Mader after Robert Dierkes
  4.  
  5.      1.0B2 (MD, 09/09/93) -- change QDLocalToFixedGlobal to GXConvertQDPoint, including
  6.                             removing validation just for B2
  7.  */
  8.  
  9. /* Copyright ©1989, 1990, 1991, 1992 Apple Computer, Inc.  All rights reserved. */
  10.  
  11. /*----------------*/
  12. /*    Include Files    */
  13. /*----------------*/
  14. #ifndef THINK_C
  15. #include <Types.h>
  16. #include <Quickdraw.h>
  17. #include <Fonts.h>
  18. #include <Windows.h>
  19. #include <Dialogs.h>
  20. #include <Events.h>
  21. #include <Memory.h>
  22. #include <Menus.h>
  23. #include <Desk.h>
  24. #include <Script.h>
  25. #include <ToolUtils.h>
  26. #include <OSEvents.h>
  27. #include <SegLoad.h>
  28. #define thePort qd.thePort
  29. #define screenBits qd.screenBits
  30. #endif
  31.  
  32. #include "graphics toolbox.h"
  33. #include "graphics libraries.h"
  34. #include "graphics debugging.h"
  35. #include "qd library.h"
  36.  
  37. #include "layout feature constants.h"
  38. #include "layout library.h"
  39. #include "font routines.h"
  40. #include "font library.h"
  41. #include "font menu library.h"
  42. #include "layout edit library.h"
  43.  
  44.  
  45. /*----------------*/
  46. /*        Menu Bar        */
  47. /*----------------*/
  48. enum
  49. {
  50.     appleMenuID    = 128,
  51.     fileMenuID,
  52.     editMenuID,
  53.     fontMenuID,
  54.     nestingMenuID
  55. };
  56.  
  57. enum
  58. {
  59.     /* Apple Menu */
  60.     aboutCommand = 1,
  61.  
  62.     /* File Menu */
  63.     quitCommand = 1,
  64.     
  65.     /* Edit Menu */
  66.     undoCommand = 1,
  67.     dash0Command,
  68.     cutCommand,
  69.     copyCommand,
  70.     pasteCommand,
  71.     clearCommand,
  72.     
  73.     /* nesting menu */
  74.     zeroCommand = 1,
  75.     oneCommand,
  76.     twoCommand,
  77.     threeCommand,
  78.     fourCommand,
  79.     fiveCommand,
  80.     sixCommand,
  81.     sevenCommand,
  82.     eightCommand,
  83.     nineCommand,
  84.     tenCommand,
  85.     elevenCommand,
  86.     twelveCommand,
  87.     thirteenCommand,
  88.     fourteenCommand,
  89.     fifteenCommand,
  90.     dash1Command,
  91.     nestCommand,
  92.     unnestCommand
  93.     
  94.     
  95. };
  96.  
  97. /*----------------*/
  98. /*        About Box        */
  99. /*----------------*/
  100. enum
  101. {
  102.     aboutDLOG = 128,
  103.  
  104.     okButton = 1,
  105.     showsItem,
  106.     authorItem
  107. };
  108.  
  109.  
  110. /*------------------*/
  111. /*            Defines            */
  112. /*------------------*/
  113. #define        inch            72
  114. #define        halfInch        36
  115. #define        quarterInch        18
  116.  
  117. #define        windowOnTop        ((WindowPtr)-1)
  118. #define        margin            quarterInch
  119. #define        windowTitleHt    20
  120. #define        windowWidth        9*inch
  121. #define        windowHeight    4*inch
  122. #define        windowTitle        "\p\024 Basic Layout Sample"
  123. #define        noRefCon        (long) 0
  124.  
  125. #define        hiliteAllMenus    (short) 0
  126.  
  127. typedef struct {
  128.     gxFont fontID;
  129.     gxStyle fontStyle;
  130. } FontMenuData;
  131.  
  132. /*----------------------*/
  133. /* Global Declarations    */
  134. /*----------------------*/
  135. Boolean quitApp;
  136. MenuHandle appleMenu, fileMenu, editMenu, fontMenu, nestingMenu;
  137. short fontMenuCount;
  138. FontMenuData *fontMenuData;
  139. WindowPtr layoutWindow;
  140. Rect dragRect;
  141. gxShape eraser;
  142.  
  143.  
  144. static void InitMacintosh(void)
  145. {    
  146.     MaxApplZone();
  147.     MoreMasters();
  148.     MoreMasters();
  149.  
  150.     /* gxInitialize graphics system */
  151.     GXEnterGraphics();
  152.     SetGraphicsLibraryErrors();
  153.     SetGraphicsLibraryNotices();
  154.     InitCommonColors();
  155.     
  156.     /* gxInitialize other toolbox managers */
  157.     InitGraf(&thePort);
  158.     InitFonts();
  159.     FlushEvents(everyEvent, 0);
  160.     InitWindows();
  161.     InitMenus();
  162.     InitCursor();
  163.  
  164. }    /* InitMacintosh */
  165.  
  166.  
  167. static void ShowAboutBox(void)
  168. {    GrafPtr savePort;
  169.     DialogPtr theDialog;
  170.     short itemType;
  171.     Handle itemHdl;
  172.     Rect itemRect;
  173.     short itemHit;
  174.  
  175.     GetPort(&savePort);
  176.     theDialog = GetNewDialog(aboutDLOG, nil, (WindowPtr) -1);
  177.     SetPort(theDialog);
  178.  
  179.     GetDItem(theDialog, authorItem, &itemType, &itemHdl, &itemRect);
  180.     SetIText(itemHdl, (StringPtr) "\pDr. Strangemorph");
  181.     GetDItem(theDialog, showsItem, &itemType, &itemHdl, &itemRect);
  182.     SetIText(itemHdl, (StringPtr) "\pbasic layout");
  183.  
  184.     do
  185.     {
  186.         ModalDialog(nil, &itemHit);
  187.     }
  188.     while (itemHit != okButton);
  189.  
  190.     CloseDialog(theDialog);
  191.  
  192.     SetPort(savePort);
  193.  
  194. }    /* ShowAboutBox */
  195.  
  196.  
  197. static gxStyle FontMenuItemStyle(short fontItem)
  198. {    FontMenuData *fmd = fontMenuData;
  199.     gxFont fontID;
  200.     Str255 gxFontName;
  201.  
  202.     GetItem(fontMenu, fontItem, gxFontName);
  203.     
  204.     fontID = FindPNameFont(gxFullFontName, gxFontName);
  205.     
  206.     while (fmd->fontStyle)
  207.     {    if (fmd->fontID == fontID) return fmd->fontStyle;
  208.         ++fmd;
  209.     }
  210.  
  211.     fmd->fontID = fontID;
  212.     fmd->fontStyle = GXNewStyle();
  213.     GXSetStyleFont(fmd->fontStyle, fontID);
  214.     GXSetStyleTextSize(fmd->fontStyle, ff(40));
  215.     
  216.     return fmd->fontStyle;
  217. }
  218.  
  219. static void DisposeFontMenu(void)
  220. {    FontMenuData *fmd = fontMenuData;
  221.     
  222.     while (fmd->fontStyle) GXDisposeStyle(fmd++->fontStyle);
  223.     
  224.     DisposPtr((Ptr) fontMenuData);
  225. }
  226.  
  227. static void SetUpMenus(void)
  228. {    short i;
  229.     FontMenuData *fmd;
  230.  
  231.     InsertMenu(appleMenu = GetMenu(appleMenuID), 0);
  232.     AddResMenu(appleMenu, (ResType) 'DRVR');
  233.     InsertMenu(fileMenu  = GetMenu(fileMenuID), 0);
  234.     InsertMenu(editMenu  = GetMenu(editMenuID), 0);
  235.     EnableItem(GetMHandle(editMenuID), cutCommand);
  236.     EnableItem(GetMHandle(editMenuID), copyCommand);
  237.     EnableItem(GetMHandle(editMenuID), pasteCommand);
  238.     EnableItem(GetMHandle(editMenuID), clearCommand);
  239.     
  240.     fontMenu = NewMenu(fontMenuID, (StringPtr) "\pStyle");
  241.     FontMenu(fontMenu);
  242.     InsertMenu(fontMenu, 0);
  243.     
  244.     fontMenuCount = CountMItems(fontMenu);
  245.     fontMenuData = (FontMenuData *) NewPtr(fontMenuCount * sizeof (FontMenuData));
  246.     
  247.     for (fmd = fontMenuData, i = fontMenuCount - 1; i >= 0; --i, ++fmd) fmd->fontStyle = nil;
  248.     
  249.     nestingMenu = NewMenu(nestingMenuID, (StringPtr) "\pNesting");
  250.     AppendMenu(nestingMenu, (StringPtr) "\p0;1;2;3;4;5;6;7;8;9;10;11;12;13;14;15;(-;Nest;UnNest");
  251.     InsertMenu(nestingMenu, 0);
  252.     
  253.     DrawMenuBar();
  254.  
  255. }    /* SetUpMenus */
  256.  
  257.  
  258. static void SetUpWindow(void)
  259. {    Rect windowBounds;
  260.     gxViewPort myPort;
  261.  
  262.     SetRect(&windowBounds,
  263.         margin,
  264.         GetMBarHeight() + margin + windowTitleHt,
  265.         windowWidth  - margin,
  266.         windowHeight - margin);
  267.  
  268.     dragRect = screenBits.bounds;
  269.  
  270.     layoutWindow = NewWindow(
  271.         nil,
  272.         &windowBounds,
  273.         (StringPtr) windowTitle,
  274.         true,
  275.         zoomDocProc,
  276.         windowOnTop,
  277.         true,
  278.         noRefCon);
  279.  
  280.     myPort = GXNewWindowViewPort(layoutWindow);
  281.     SetDefaultViewPort(myPort);
  282. }    /* SetUpWindow */
  283.  
  284.  
  285. static void UpdateAppWindow(WindowPtr theWindow)
  286. {
  287.     InvalRect(&theWindow->portRect);
  288.  
  289. }    /*    UpdateAppWindow    */
  290.  
  291.  
  292. static void DoMenuCommand(LayoutEditHandle layoutHandle, long menuResult)
  293. {    short menuID, itemNumber;
  294.     GrafPtr savePort;
  295.     Str255 daName;
  296.  
  297.     if (! menuResult)
  298.         return;
  299.  
  300.     menuID  = HiWord(menuResult);
  301.     itemNumber = LoWord(menuResult);
  302.  
  303.     switch (menuID)
  304.     {
  305.         case appleMenuID:
  306.             switch (itemNumber)
  307.             {
  308.                 case aboutCommand:
  309.                     ShowAboutBox();
  310.                     break;
  311.  
  312.                 default:
  313.                     GetItem(appleMenu, itemNumber, daName);
  314.                     GetPort(&savePort);
  315.                     (void) OpenDeskAcc(daName);
  316.                     SetPort(savePort);
  317.                     break;
  318.             }
  319.             break;
  320.  
  321.         case fileMenuID:
  322.             switch(itemNumber)
  323.             {
  324.                 case quitCommand:
  325.                     quitApp = true;
  326.                     break;
  327.  
  328.                 default:
  329.                     break;
  330.             }
  331.             break;
  332.             
  333.         case editMenuID:
  334.             switch(itemNumber)
  335.             {    case cutCommand:
  336.                     LayoutEditCut(layoutHandle);
  337.                     break;
  338.                 
  339.                 case copyCommand:
  340.                     LayoutEditCopy(layoutHandle);
  341.                     break;
  342.                 
  343.                 case pasteCommand:
  344.                     LayoutEditPaste(layoutHandle);
  345.                     break;
  346.                 
  347.                 case clearCommand:
  348.                     LayoutEditClear(layoutHandle);
  349.                     break;
  350.             }
  351.             break;
  352.             
  353.             case fontMenuID:
  354.             {    gxStyle menuStyle = FontMenuItemStyle(itemNumber);
  355.             
  356.                 if (menuStyle) LayoutEditSetStyle(layoutHandle, menuStyle);
  357.                 break;
  358.             }
  359.                 
  360.             case nestingMenuID:
  361.                 switch (itemNumber)
  362.                 {    case nestCommand:
  363.                         LayoutEditIncrementLevel(layoutHandle);
  364.                         break;
  365.                         
  366.                     case unnestCommand:
  367.                         LayoutEditDecrementLevel(layoutHandle);
  368.                         break;
  369.                     
  370.                     default:
  371.                         LayoutEditSetLevel(layoutHandle, itemNumber - zeroCommand);
  372.                         break;
  373.                 }
  374.                 break;
  375.  
  376.         default:
  377.             break;
  378.     }  /*  switch (menuID)  */
  379.  
  380.     HiliteMenu(hiliteAllMenus);
  381.  
  382. }    /*    DoMenuCommand  */
  383.  
  384.  
  385. static void DoGrowBox(EventRecord *pEvent, WindowPtr theWindow)
  386. {    long newSize;
  387.  
  388.     if (newSize = GrowWindow(theWindow, pEvent->where, &screenBits.bounds))
  389.     {
  390.         SizeWindow(theWindow, (short) newSize, (short) (newSize >> 16), true);
  391.         UpdateAppWindow(theWindow);
  392.     }
  393.  
  394. }    /*    DoGrowBox  */
  395.  
  396.  
  397. static void DoZoomBox(EventRecord    *pEvent, WindowPtr theWindow, short windowPart)
  398. {
  399.     if (TrackBox(theWindow, pEvent->where, windowPart))
  400.     {
  401.         ZoomWindow(theWindow, windowPart, true);
  402.         UpdateAppWindow(theWindow);
  403.     }
  404.  
  405. }    /*    DoZoomBox  */
  406.  
  407.  
  408. static void DoNullEvent(LayoutEditHandle layoutHandle)
  409. {
  410.     LayoutEditIdle(layoutHandle);
  411. }    /*    DoNullEvent  */
  412.  
  413.  
  414. static void DoMouseDown(LayoutEditHandle layoutHandle, EventRecord *pEvent)
  415. {    short windowPart;
  416.     WindowPtr whichWindow;
  417.     gxValidationLevel     currentValidation;
  418.  
  419.     windowPart = FindWindow(pEvent->where, &whichWindow);
  420.  
  421.     switch (windowPart)
  422.     {
  423.         case inDesk:
  424.             break;
  425.     
  426.         case inMenuBar:
  427.             DoMenuCommand(layoutHandle, MenuSelect(pEvent->where));
  428.             break;
  429.     
  430.         case inSysWindow:
  431.             SystemClick(pEvent, whichWindow);
  432.             break;
  433.     
  434.         case inContent:
  435.             if (whichWindow != FrontWindow())
  436.                 SelectWindow(whichWindow);
  437.             else
  438.             {    gxPoint hitDown;
  439.             
  440.      //
  441.      //    Unfortunately, GXConvertQDPoint(..) will not survive validation with the QD GX ß2
  442.      //    seed. Therefore, we get the validation level set up by the application,  and turn the
  443.      //    validation off. We will reset the validation to it's original setting below.
  444.      //
  445.      //    This problem has already been fixed in the QD GX ß3 build, therefore this work around 
  446.      //    will be removed at ß3. Details about the parameters for the GXConvertQDPoint (..) call
  447.      //    can be found in the QD GX ß2 Graphics Notes within the "• Open Me First •" folder.
  448.      // 
  449.                 currentValidation = GXGetValidation();
  450.                 if (currentValidation) GXSetValidation(gxNoValidation);
  451.                 
  452.                 /**  Convert the global Quickdraw coordinates to local fixed coordinates.  **/
  453.                 GXConvertQDPoint(&pEvent->where, 0, &hitDown);
  454.             
  455.     //
  456.     //    Reset the validation to the original setting.
  457.     //
  458.                 if (currentValidation) GXSetValidation(currentValidation);
  459.  
  460.                 LayoutEditClick(layoutHandle, hitDown);
  461.             }
  462.             break;
  463.     
  464.         case inDrag:
  465.             if (whichWindow == layoutWindow)
  466.                 DragWindow(layoutWindow, pEvent->where, &dragRect);
  467.             break;
  468.     
  469.         case inGrow:
  470.             DoGrowBox(pEvent, whichWindow);
  471.             break;
  472.     
  473.         case inGoAway:
  474.                 if (whichWindow == layoutWindow && 
  475.                     TrackGoAway(layoutWindow, pEvent->where))
  476.                 quitApp = true;
  477.             break;
  478.     
  479.         case inZoomIn:
  480.         case inZoomOut:
  481.             DoZoomBox(pEvent, whichWindow, windowPart);
  482.             break;
  483.     
  484.         default:
  485.             break;
  486.     }    /* switch */
  487.  
  488. }    /*    DoMouseDown  */
  489.  
  490.  
  491. static void DoKeyStroke(LayoutEditHandle layoutHandle, EventRecord *pEvent)
  492. {    char charCode;
  493.  
  494.     charCode = pEvent->message & charCodeMask;
  495.  
  496.     if (pEvent->modifiers & btnState)
  497.     {
  498.         /*--------------*/
  499.         /* Button is UP */
  500.         /*--------------*/
  501.         if (pEvent->modifiers & cmdKey)
  502.         {
  503.             /*--------------*/
  504.             /* Command key    */
  505.             /*--------------*/
  506.             DoMenuCommand(layoutHandle, MenuKey(charCode));
  507.         }
  508.         else LayoutEditKey(layoutHandle, charCode);
  509.     }
  510.  
  511. }    /*    DoKeyStroke  */
  512.  
  513.  
  514. static void DoUpdate(LayoutEditHandle layoutHandle, EventRecord *pEvent)
  515. {    GrafPtr savedPort;
  516.     WindowPtr pUpdateWindow;
  517.  
  518.     GetPort(&savedPort);
  519.  
  520.     pUpdateWindow = (WindowPtr) pEvent->message;
  521.  
  522.     SetPort(pUpdateWindow);
  523.     BeginUpdate(pUpdateWindow);
  524.     GXDrawShape(eraser);
  525.  
  526.     LayoutEditUpdate(layoutHandle);
  527.  
  528.     EndUpdate(pUpdateWindow);
  529.     SetPort(savedPort);
  530.  
  531. }    /*    DoUpdate  */
  532.  
  533.  
  534. static void DoActivate(LayoutEditHandle layoutHandle, EventRecord *pEvent)
  535. {    WindowPtr pActiveWindow;
  536.  
  537.     /*--------------------------------------*/
  538.     /* Get the window to de/activate        */
  539.     /* and its kind from the event message    */
  540.     /*--------------------------------------*/
  541.     pActiveWindow = (WindowPtr) pEvent->message;
  542.  
  543.     /*-----------------*/
  544.     /* Activate window */
  545.     /*-----------------*/
  546.     if (pEvent->modifiers & activeFlag)
  547.     {
  548.         /* Enable/Disable items */
  549.         SetPort(pActiveWindow);
  550.         LayoutEditActivate(layoutHandle);
  551.         LayoutEditFromScrap(layoutHandle);
  552.     }
  553.     else
  554.     /*-------------------*/
  555.     /* Deactivate window */
  556.     /*-------------------*/
  557.     {
  558.         /* Enable/Disable items */
  559.         LayoutEditToScrap(layoutHandle);
  560.         LayoutEditDeactivate(layoutHandle);
  561.     }
  562.  
  563. }    /*    DoActivate  */
  564.  
  565.  
  566. static void DoEvent(LayoutEditHandle layoutHandle)
  567. {    EventRecord    theEvent;
  568.  
  569.     SystemTask();
  570.     GetNextEvent(everyEvent, &theEvent);
  571.  
  572.     switch (theEvent.what)
  573.     {
  574.         case nullEvent:
  575.             DoNullEvent(layoutHandle);
  576.             break;
  577.  
  578.         case mouseDown:
  579.             DoMouseDown(layoutHandle, &theEvent);
  580.             break;
  581.  
  582.         case mouseUp:
  583.             break;
  584.  
  585.         case keyDown:
  586.         case autoKey:
  587.             DoKeyStroke(layoutHandle, &theEvent);
  588.             break;
  589.  
  590.         case keyUp:
  591.             break;
  592.  
  593.         case updateEvt:
  594.             DoUpdate(layoutHandle, &theEvent);
  595.             break;
  596.  
  597.         case activateEvt:
  598.             DoActivate(layoutHandle, &theEvent);
  599.             break;
  600.  
  601.         case diskEvt:
  602.         case networkEvt:
  603.         case driverEvt:
  604.         default:
  605.             break;
  606.         }  /* switch (theEvent.what)  */
  607.  
  608. }    /* DoEvent */
  609.  
  610.  
  611. static short StrLength(char *s)
  612. {short len;
  613.  
  614.     for (len = 0; *s++ != 0; len++) ;
  615.     return len;
  616. }
  617.  
  618. void main(void)
  619. {    LayoutEditHandle layoutHandle;
  620.     gxRunControls gxRunControls;
  621.     gxLayoutOptions gxLayoutOptions;
  622.     gxStyle hoefler, times, baghdad;
  623.     char *text1 = "The wicked ";
  624.     char *text2 = "fast ";
  625.                                              /* The following is "Macintosh" in Arabic: */
  626.                                              /* meem, alif, kaf,  noon, tah,  wau,  shin, */
  627.     static char text3[] = {0xE5, 0xC7, 0xE3, 0xE6, 0xCA, 0xE8, 0xD4, 0};
  628.     char *text4 = " lives!";
  629.     char *textRuns[4];
  630.     short level = 0, textLengths[4], totalLength;
  631.     gxStyle textStyles[4];
  632.     gxPoint posn = {ff(halfInch + quarterInch), ff(inch + halfInch)};
  633.  
  634.     InitMacintosh();
  635.     SetUpMenus();
  636.     SetUpWindow();
  637.  
  638.     eraser = GXNewShape(gxFullType);
  639.     SetShapeCommonColor(eraser, gxWhite);
  640.  
  641.     /*-------------------------------------*/
  642.     /* Make a canned layout to start with  */
  643.     /*-------------------------------------*/
  644.     
  645.     /* gxInitialize the textRuns array */
  646.     textRuns[0] = text1;
  647.     textRuns[1] = text2;
  648.     textRuns[2] = text3;
  649.     textRuns[3] = text4;
  650.     
  651.     /* gxInitialize the textLengths array */
  652.     textLengths[0] = StrLength(text1);
  653.     textLengths[1] = StrLength(text2);
  654.     textLengths[2] = StrLength(text3);
  655.     textLengths[3] = StrLength(text4);
  656.  
  657.     totalLength = textLengths[0] + textLengths[1] + textLengths[2] + textLengths[3];
  658.     
  659.     /* Make a default gxLayoutOptions and gxRunControls */
  660.     InitializeLayoutOptions (&gxLayoutOptions);
  661.     InitializeRunControls (&gxRunControls);
  662.     
  663.     hoefler = NewLayoutStyle(
  664.         (char *) "\pHoefler Italic",
  665.         ff(40),
  666.         0,
  667.         &gxRunControls,
  668.         nil,
  669.         0,
  670.         nil);
  671.         
  672.     times = NewLayoutStyle(
  673.         (char *) "\pTimes Roman",
  674.         ff(40),
  675.         0,
  676.         &gxRunControls,
  677.         nil,
  678.         0,
  679.         nil);
  680.  
  681.     baghdad = NewLayoutStyle(
  682.         (char *) "\pBaghdad Plain",
  683.         ff(40),
  684.         0,
  685.         &gxRunControls,
  686.         nil,
  687.         0,
  688.         nil);
  689.     
  690.     textStyles[0] = hoefler;
  691.     textStyles[1] = times;
  692.     textStyles[2] = baghdad;
  693.     textStyles[3] = hoefler;
  694.     
  695.     layoutHandle = NewLayoutEditHandle(
  696.         4,
  697.         textLengths,
  698.         (void *) textRuns,
  699.         4,
  700.         textLengths,
  701.         textStyles,
  702.         1,
  703.         &totalLength,
  704.         &level,
  705.         &gxLayoutOptions,
  706.         &posn,
  707.         hoefler);
  708.         
  709.     GXDisposeStyle(hoefler);
  710.     GXDisposeStyle(times);
  711.     GXDisposeStyle(baghdad);
  712.  
  713.     while (!quitApp)
  714.         DoEvent(layoutHandle);
  715.  
  716.     GXDisposeShape(eraser);
  717.     DisposeWindow(layoutWindow);
  718.     DisposeLayoutEditHandle(layoutHandle);
  719.     DisposeCommonColors();
  720.     DisposeFontMenu();
  721.     GXExitGraphics();
  722.     ExitToShell();
  723.  
  724. }    /* main */
  725.